function pdr=ExpectPdr( snr, length)
    gamma_0e = pdrToGamma(0.001,length);
    gamma_1e = pdrToGamma(0.999,length);

    gamma_A = pdrToGamma(0.1,length);
    gamma_B = pdrToGamma(0.9,length);
    global sigma;
    m_ge = ( normpdf(gamma_1e, snr, sigma) - normpdf(gamma_0e, snr,sigma))/ (gamma_1e - gamma_0e);

    b_ge = (normpdf(gamma_0e, snr, sigma) * gamma_1e - normpdf(gamma_1e, snr, sigma)*gamma_0e)/(gamma_1e - gamma_0e);

    m_e = (0.9 - 0.1)/(gamma_B - gamma_A);

    b_e = (0.1 * gamma_B - 0.9 * gamma_A)/ (gamma_B - gamma_A);

    %Q = normcdf ((snr - gamma_1e)/sigma, 0,1);

        pdr = ((m_e*m_ge)*realpow(gamma_1e, 3)/3 + (b_e*m_ge+b_ge*m_e)*realpow(gamma_1e, 2)/2 + b_e*b_ge*gamma_1e) - ...
                  ((m_e*m_ge)*realpow(gamma_0e, 3)/3 + (b_e*m_ge+b_ge*m_e)*realpow(gamma_0e, 2)/2 + b_e*b_ge*gamma_0e) + ...
                  normcdf((snr - gamma_1e) / sigma, 0, 1);
    if pdr > 1
      pdr = 1;
    end
end



